<template>
	<view class="p30">
		<auto-select :list="$tool.objList($config.master_cancel_cause)" ref="reason"
			@confirm="form.reason=$event[0].label"></auto-select>

		<view class="p30 bg-fff radius10 mb20">
			<view class="mb20">取消原因</view>
			<u-input v-model="form.reason" type="select" @click="$refs.reason.open()" placeholder="请选择取消原因" />
		</view>
		<view class="p30 bg-fff radius10 mb20">
			<view class="mb20">取消说明</view>
			<u-input type="textarea" v-model="form.explain" :clearable="false" height="300" maxlength="240"
				placeholder="请输入取消说明（选填）">
			</u-input>
			<view class="flex row-right">
				<view class="">{{form.explain.length}}/240</view>
			</view>
		</view>
		<view class="pf bg-fff p30 w-max left0 bottom0">
			<u-button shape="circle" type="warning" ripple @click="submit">提交</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					reason: '',
					explain: '',
				}
			};
		},
		methods: {
			async submit() {
				await this.$showModal('提示', '确认取消订单吗')
				this.$request('/master/order/cancelOrder', {
					...this.form,
					...this.$params,
				}).then(res => {
					this.$msg(res.msg)
					this.$navBack(1, 1000)
				})
			},
		}
	}
</script>

<style lang="scss">

</style>